import mcApi from 'mc-c2b2m-operator-api';
import { BasicColumn, FormSchema } from '@/components/Table';

const { SystemModule } = mcApi;
const { OrgApi } = SystemModule;

export const tableColumns: BasicColumn[] = [
  { title: '用户ID', dataIndex: 'id' },
  { title: '注册手机', dataIndex: 'phone' },
  { title: '注册时间', dataIndex: 'createdTime' },
  { title: '推荐人', dataIndex: 'referrerOrgMemberName' },
  { title: '钱包余额（元）', dataIndex: 'totalBalance' },
];
export const tableFormSchema: FormSchema[] = [
  {
    field: 'phone',
    label: '注册手机',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '注册时间',
    field: 'createdTime',
    component: 'RangePicker',
    colProps: { span: 6 },
  },
];

export const modalFormSchema: FormSchema[] = [
  {
    ifShow: false,
    label: '被推荐人',
    required: true,
    component: 'Input',
    field: 'referralUserId',
  },
  {
    label: '推荐人',
    required: true,
    component: 'ApiSelect',
    field: 'referrerUserId',
    componentProps: {
      valueField: 'operatorId',
      labelField: 'realName',
      resultField: 'items',
      api: OrgApi.getOrgMemberPage,
    },
  },
];
